package com.eastmoney.emis.edda.infrastructure.report;

import java.lang.reflect.Field;

public class DDAReportRecord {
    @Record(0)
    private String merchantRequestIdentification;
    @Record(1)
    private String mandateIdentification;
    @Record(2)
    private String creditorReference;
    @Record(3)
    private String financialInstitutionIdentification;
    @Record(4)
    private String maximumAmount;
    @Record(5)
    private String maximumAmountCurrency;
    @Record(6)
    private String frequencyType;
    @Record(7)
    private String countPerPeriod;
    @Record(8)
    private String chargeAmount;
    @Record(9)
    private String chargeCollectionDate;
    @Record(10)
    private String durationToDate;
    @Record(11)
    private String mandateStatus;
    @Record(12)
    private String lastUpdateTime;
    @Record(13)
    private String registrationDate;
    @Record(14)
    private String rejectReasonCode;
    @Record(15)
    private String rejectReasonInformation;

    public DDAReportRecord() {
    }

    public DDAReportRecord(String csvRecord) {
        if (csvRecord == null) {
            return;
        }
        String[] dataArray = csvRecord.split(",");
        if (dataArray.length != 16) {
            return;
        }
        Field[] fields = getClass().getDeclaredFields();
        try {
            for (Field field : fields) {
                Record record = field.getAnnotation(Record.class);
                field.set(this, dataArray[record.value()].replace("\"", ""));
            }
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }

    }


    public String getMerchantRequestIdentification() {
        return merchantRequestIdentification;
    }

    public void setMerchantRequestIdentification(String merchantRequestIdentification) {
        this.merchantRequestIdentification = merchantRequestIdentification;
    }

    public String getMandateIdentification() {
        return mandateIdentification;
    }

    public void setMandateIdentification(String mandateIdentification) {
        this.mandateIdentification = mandateIdentification;
    }

    public String getCreditorReference() {
        return creditorReference;
    }

    public void setCreditorReference(String creditorReference) {
        this.creditorReference = creditorReference;
    }

    public String getFinancialInstitutionIdentification() {
        return financialInstitutionIdentification;
    }

    public void setFinancialInstitutionIdentification(String financialInstitutionIdentification) {
        this.financialInstitutionIdentification = financialInstitutionIdentification;
    }

    public String getMaximumAmount() {
        return maximumAmount;
    }

    public void setMaximumAmount(String maximumAmount) {
        this.maximumAmount = maximumAmount;
    }

    public String getMaximumAmountCurrency() {
        return maximumAmountCurrency;
    }

    public void setMaximumAmountCurrency(String maximumAmountCurrency) {
        this.maximumAmountCurrency = maximumAmountCurrency;
    }

    public String getFrequencyType() {
        return frequencyType;
    }

    public void setFrequencyType(String frequencyType) {
        this.frequencyType = frequencyType;
    }

    public String getCountPerPeriod() {
        return countPerPeriod;
    }

    public void setCountPerPeriod(String countPerPeriod) {
        this.countPerPeriod = countPerPeriod;
    }

    public String getChargeAmount() {
        return chargeAmount;
    }

    public void setChargeAmount(String chargeAmount) {
        this.chargeAmount = chargeAmount;
    }

    public String getChargeCollectionDate() {
        return chargeCollectionDate;
    }

    public void setChargeCollectionDate(String chargeCollectionDate) {
        this.chargeCollectionDate = chargeCollectionDate;
    }

    public String getDurationToDate() {
        return durationToDate;
    }

    public void setDurationToDate(String durationToDate) {
        this.durationToDate = durationToDate;
    }

    public String getMandateStatus() {
        return mandateStatus;
    }

    public void setMandateStatus(String mandateStatus) {
        this.mandateStatus = mandateStatus;
    }

    public String getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(String lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public String getRegistrationDate() {
        return registrationDate;
    }

    public void setRegistrationDate(String registrationDate) {
        this.registrationDate = registrationDate;
    }

    public String getRejectReasonCode() {
        return rejectReasonCode;
    }

    public void setRejectReasonCode(String rejectReasonCode) {
        this.rejectReasonCode = rejectReasonCode;
    }

    public String getRejectReasonInformation() {
        return rejectReasonInformation;
    }

    public void setRejectReasonInformation(String rejectReasonInformation) {
        this.rejectReasonInformation = rejectReasonInformation;
    }

    @Override
    public String toString() {
        return "DDAReportRecord{" +
                "merchantRequestIdentification='" + merchantRequestIdentification + '\'' +
                ", mandateIdentification='" + mandateIdentification + '\'' +
                ", creditorReference='" + creditorReference + '\'' +
                ", financialInstitutionIdentification='" + financialInstitutionIdentification + '\'' +
                ", maximumAmount='" + maximumAmount + '\'' +
                ", maximumAmountCurrency='" + maximumAmountCurrency + '\'' +
                ", frequencyType='" + frequencyType + '\'' +
                ", countPerPeriod='" + countPerPeriod + '\'' +
                ", chargeAmount='" + chargeAmount + '\'' +
                ", chargeCollectionDate='" + chargeCollectionDate + '\'' +
                ", durationToDate='" + durationToDate + '\'' +
                ", mandateStatus='" + mandateStatus + '\'' +
                ", lastUpdateTime='" + lastUpdateTime + '\'' +
                ", registrationDate='" + registrationDate + '\'' +
                ", rejectReasonCode='" + rejectReasonCode + '\'' +
                ", rejectReasonInformation='" + rejectReasonInformation + '\'' +
                '}';
    }
}
